interface IPartial {
  name: string;
  age: number;
  slogan?: string;
}

// 类型体操
type keys = keyof IPartial; // name | age | slogan
type Res = keyof any;// => number|string|symbol

// 确实keys一定是可以作为key的联合类型
type RecordType<Keys extends keyof any, T> = {
  [P in Keys]: T
}

// 都变成可选的
type t1 = "上海" | "北京" | "洛杉矶"
// record表示: key是t1中的值, value是IPartial
type IPartials = RecordType<t1, IPartial>

const infos: IPartials = {
  "上海": {
    name: "xxx",
    age: 10
  },
  "北京": {
    name: "yyy",
    age: 5
  },
  "洛杉矶": {
    name: "zzz",
    age: 3
  }
}

export {}
